import time

from utils.utils import mouseClick, keydownup


def startgame():
    mouseClick(image=r"imgs\play.png")
    time.sleep(3)
    mouseClick(image=r"imgs\renjiduizhan.png")
    time.sleep(3)
    mouseClick(image=r"imgs\yiban.png")
    time.sleep(3)
    mouseClick(image=r"imgs\queren.png")
    time.sleep(3)
    mouseClick(image=r"imgs\xunzhaoduiju.png",confidence=0.7)
    time.sleep(3)
    while True:
        if mouseClick(image=r"imgs\jieshou.png"):
            break
    while True:
        if mouseClick(image=r"imgs\VN.png"):
            time.sleep(3)
            mouseClick(image=r"imgs\suoding.png")
            break
    while True:
        time.sleep(3)
        keydownup(key="b")
        if mouseClick(image=r"imgs\canplay.png",confidence=0.8):
            return 0